//
//  Day01ViewController.swift
//  SwiftDemo
//
//  Created by zhudeshuai on 2018/9/14.
//  Copyright © 2018年 zhudeshuai. All rights reserved.
//

import Foundation
import UIKit
import SnapKit
class Day01ViewController: BaseViewController {
    
    let showLabel = UILabel()
    override func viewDidLoad() {
        super.viewDidLoad()
       
        initView();
    }
    
    func initView() {
        topBar.setTitle(title: "Day01")
        contentView.backgroundColor = UIColor.white
        //UI
        showLabel.text = "I am the king of the world";
        contentView.addSubview(showLabel)
        showLabel.snp.makeConstraints{(make) in
            make.top.equalTo(100)
            make.centerX.equalTo(self.view)
        }
        
        let changeBtn = UIButton(type:.custom)
        changeBtn.setTitle("Change Font Family", for: .normal)
        changeBtn.addTarget(self, action: #selector(changeFontFamily), for: .touchUpInside)
        changeBtn.setTitleColor(UIColor.blue, for: .normal)
        contentView.addSubview(changeBtn)
        changeBtn.layer.borderColor = UIColor.black.cgColor
        changeBtn.layer.borderWidth = 1
        changeBtn.layer.cornerRadius = 5
        changeBtn.snp.makeConstraints{(make) in
            make.top.equalTo(500)
            make.centerX.equalTo(self.view)
            
        }
        
    }
    
    @objc func changeFontFamily() -> Void {
        showLabel.font = UIFont(name: "Savoye LET", size: 30)
        printAllSupportFontNames()
    }
    
    func printAllSupportFontNames() {
        let familyNames = UIFont.familyNames
        for familyName in familyNames {
            print(familyName)
        }
    }

}
